<?php

/*
 * This class is used for as Model for Admin table 
 */

class Model_Acl extends Model_Base {

    /**
     * Returns different types of roles assigned in the system
     *
     * @return array|
     */
    public function getRoles() {
        $roles = Array('1' => 'ADMIN', '2' => 'CUSTOMER', '3' => 'CONTRACTOR', '4' => 'DESIGNER');
        return $roles;
    }

    /**
     * Returns global resources for the ACL which are allowed for all users
     *
     * @return array|
     */
    public function getResources() {
        
        //Add all controller over here
        
        $RESOURCES_ARRAY = Array(
            'index' => Array(),
            'customer' => Array(
                'form' => Array('displayname' => 'Add/Edit', 'action' => 'form'),
                'profile' => Array('displayname' => 'Edit Profile', 'action' => 'profile'),
                'list' => Array('displayname' => 'Listing', 'action' => 'list'),
                'project'=> Array('displayname' => 'Customer Projects', 'action' => 'project'),
                'projectdetail'=> Array('displayname' => 'Customer Project Dasboard', 'action' => 'projectdetail'),
                'delete' => Array('displayname' => 'Delete', 'action' => 'delete'),
            ),
            'contractor' => Array(
                'form' => Array('displayname' => 'Add/Edit', 'action' => 'form'),
                'profile' => Array('displayname' => 'Edit Profile', 'action' => 'profile'),
                'list'=> Array('displayname' => 'Listing', 'action' => 'list'),
                'project'=> Array('displayname' => 'Contractor Projects', 'action' => 'project'),
                'projectdetail'=> Array('displayname' => 'Contractor Project Dasboard', 'action' => 'projectdetail'),
                'delete'=> Array('displayname' => 'Delete', 'action' => 'delete'),
            ),
            'designer' => Array(
                'form' => Array('displayname' => 'Form', 'action' => 'form'),
                'profile' => Array('displayname' => 'Profile', 'action' => 'profile'),
                'list' => Array('displayname' => 'Listing', 'action' => 'list'),
                'delete' => Array('displayname' => 'Delete', 'action' => 'delete'),
            ),
            
            'product' => Array(
                'form' => Array('displayname' => 'Add/Edit', 'action' => 'form'),
                'list' => Array('displayname' => 'Listing', 'action' => 'list'),
                'delete' => Array('displayname' => 'Delete', 'action' => 'delete'),
                
            ),
            'job' => Array(
                'form' => Array('displayname' => 'Add/Edit', 'action' => 'form'),
                'list' => Array('displayname' => 'Listing', 'action' => 'list'),
                'delete' => Array('displayname' => 'Delete', 'action' => 'delete'),
                
            ),
            'calculator' => Array(
                'index' => Array('displayname' => 'Calculator', 'action' => 'index'),
            ),
            'quotation' => Array(
                'list'=> Array('displayname' => 'Listing', 'action' => 'list'),
                'form' => Array('displayname' => 'Add/Edit', 'action' => 'form'),
                'delete' => Array('displayname' => 'Delete', 'action' => 'delete'),
            ),
            'project' => Array(
                'form' => Array('displayname' => 'Add/Edit', 'action' => 'form'),
                'list' => Array('displayname' => 'Listing', 'action' => 'list'),
                'delete' => Array('displayname' => 'Delete', 'action' => 'delete'),
                
            ),
            'role' => Array(),
            'preference' => Array(),
            'login' => Array(),
            'error' => Array(),
            'logout' => Array(),
        );
        return $RESOURCES_ARRAY;
    }

    /**
     * Returns global resources for the ACL which are allowed for all users roles
     *
     * @return array|
     */
    public function getGlobalResources() {
        $GLOBAL_RESOURCESARRAY = Array(
            'index' => Array(
                'index',
            ),
            'error' => Array(
                'error',
            ),
            'calculator' => Array(
                'generateinventorylist',
                'generateproductitem',
                'generateproductsearch',
                'generatecalculatosearch'
            ),
            'preference' => Array(
                'deletecompanylogo',
                'deleteuom'
            ),
            'contractor' => Array(
                'updatecontractorimage' 
            ),
            'project' => Array(
                'deleteprojectimage',
                'generatejobsearch',
                'deleteprojectreference'
            ),
            'quotation' => Array(
                'generateinventorylist',
                'generateproductitem',
                'generateproductsearch',
                'deletequotationimage',
                'delete',
            ),
        );
        return $GLOBAL_RESOURCESARRAY;
    }

}
